#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<string.h>
#include<unistd.h>
int main()
{
  umask(0);
  int fd=open("test.txt",O_CREAT | O_WRONLY |O_APPEND,0666);
  if(fd<0)
  {
    perror("open");
    return 1;
  }
  printf("fd: %d\n",fd);
  //const char *msg="abcd";
  //int cnt=1;
  //while(cnt--)
  //{
  //  write(fd,msg,strlen(msg));
  //}
  close(fd);
  return 0;
}
